<?php
/**
* @title		Shape 5 IE6 Warning - Joomla 1.5
* @version		$Id: s5_iewarning.php 1.0 2009-07-14 $
* @package		Joomla
* @copyright	Copyright (C) 2009 Shape 5 LLC. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.

*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// RegEx Pattern to identify first instance of MSIE X.X, instead of any subsequent
// instances which would otherwise trigger a false positive.
$pattern = "/MSIE (\d)\.\d/i";

$br = strtolower($_SERVER['HTTP_USER_AGENT']);
$is_ie6w = "no";

preg_match($pattern, $br, $matches);

// No matches will be returned if the browser is not IE
if(empty($matches)){
	$is_ie6w = "no";
}
// If a match is found, the major version number has been
// selected in the above pattern and the comparison will be
// made based on that number.
elseif($matches[1] <= 6) {
	$is_ie6w = "yes";
} 



if ($is_ie6w == "yes") {

?>
<!--[if IE 6]>
<style>
#s5_ie_pop {
font-family:arial;
font-size:11px;
}
</style>
<![endif]-->
<?php


jimport( 'joomla.plugin.plugin' );

	class  plgSystemIewarning extends JPlugin
		{
			function onAfterInitialise()
				{
				  global $mainframe;  
					$document = &JFactory::getDocument();  
					
					if ($this->params->get('enableclose')) {
					?>
					<!--[if IE 6]>
					<script>
					var my_div = null;
					var newDiv = null;

					function s5_addIE6close() {
						document.getElementById("s5_iepopouter").style.display = 'none';
						document.getElementById("s5_iepopinner").style.display = 'none';}
						
					</script>
					
					<div id="s5_ie_pop">

					<div id='s5_iepopouter' style='position:absolute;top:0px;z-index:998;background:#000000;filter: alpha(opacity = 80);width:100%;height:1200px;'></div>
					
					<div id='s5_iepopinner' style='padding-top:34px;border:1px solid #ffffff;position:absolute;z-index:999;background:url(plugins/system/iewarning/images/gradient.jpg) bottom repeat-x;width:345px;height:300px;left:50%;margin-left:-172px;top:200px;'>
					
					<div style='cursor:pointer;margin-right:5px;margin-top:-19px;margin-bottom:0px;float:right;background:url(plugins/system/iewarning/images/close.jpg) no-repeat;width:24px;height:24px;' onclick='s5_addIE6close();'></div><div style='clear:both;height:0px;'>
					
					<div style='margin-left:5px;margin-top:3px;margin-bottom:15px;float:left;background:url(plugins/system/iewarning/images/ie.jpg) no-repeat;width:59px;height:57px;'></div><div style='margin-top:6px;margin-bottom:15px;float:left;padding-left:5px;font-size:18px;color:#000000;'>You are using Internet Explorer 6.0 or older to view the web.</div>
					
					<div style='clear:both;'></div><div style='margin-top:-10px;margin-left:20px;width:87%;color:#000000;margin-bottom:33px;'>Due to security risks and a lack of support for web standards this website does not support IE6. Internet Explorer 6 was released in 2001 and it does not display modern web sites properly.  Please upgrade to a newer browser to fully enjoy this site and the rest of the web. <br/><br/>After you update, please come back and you will be able to view our site.</div>
					
					<a href='http://www.microsoft.com/windows/internet-explorer/' target='_blank'><center><div style='cursor:pointer;background: url(plugins/system/iewarning/images/button.jpg) no-repeat;width:142px;height:34px;line-height:30px;'><span style='font-size:18px;color:#2f82ff;'>Upgrade</span></div></center></a>
					
					</div>
					
					</div>
					<![endif]-->
					<?php
					} else {
					?>
<!--[if IE 6]>
					<div id="s5_ie_pop" >
					
					<div id='s5_iepopouter' style='position:absolute;top:0px;z-index:998;background:#000000;filter: alpha(opacity = 80);width:100%;height:1200px;'></div>
					
					<div id='s5_iepopinner' style='padding-top:34px;border:1px solid #ffffff;position:absolute;z-index:999;background:url(plugins/system/iewarning/images/gradient.jpg) bottom repeat-x;width:345px;height:320px;left:50%;margin-left:-172px;top:200px;'>
					
					<div style='margin-left:5px;float:left;background:url(plugins/system/iewarning/images/ie.jpg) no-repeat;width:59px;height:57px;'></div><div style='color:#000000;float:left;padding-left:5px;font-size:18px;'>You are using Internet Explorer 6.0 or older to view the web.</div>
					
		<div style='clear:both;'></div><div style='color:#000000;margin-top:-10px;margin-left:20px;width:87%;margin-bottom:33px;'>Due to security risks and a lack of support for web standards this website does not support IE6. Internet Explorer 6 was released in 2001 and it does not display modern web sites properly.  Please upgrade to a newer browser to fully enjoy this site and the rest of the web. <br/><br/>After you update, please come back and you will be able to view our site.</div>
		
		<a href='http://www.microsoft.com/windows/internet-explorer/' target='_blank'><center><div style='cursor:pointer;background:url(plugins/system/iewarning/images/button.jpg) no-repeat;width:142px;height:34px;line-height:30px;'><span style='font-size:18px;color:#2f82ff;'>Upgrade</span></div></center></a>
		
		</div>
		
		</div>
<![endif]-->
					<?php		
					}	
					
					
				} 	 
		}  	       

}		